function PlotOrbit(R)
    
    Re = 6378.136;
    %[km]Mean equatorial radius of the Earth.
    
    R = R / Re;
    %[Earth radii]Converts all positions from kilometers to Earth radii.
    
    n = size(R,2);
    %[]Number of points that will be plotted.
    
    r = zeros(1,n);
    %[]Allocates memory for the range vector.
    
    for k = 1:n
        
        r(k) = norm(R(:,k));
        %[Earth radii]Current range.
        
    end
    
    Extent = ceil(max(r))*1.5;
    %[]Axes extents.
    
    [xe,ye,ze] = ellipsoid(0,0,0,1,1,1,50);
    %[Earth radii]Determines the coordinates of the Earth.
    
    Earth = imread('Earth.bmp');
    %[]Loads the image of the Earth.
    
    ScreenSize = get(0,'ScreenSize');
    %[]Determines the location and dimensions of the current monitor.
    
    Window = figure( ...
        'Color','k', ...
        'Name','ORBIT IN THREE DIMENSTIONS', ...
        'NumberTitle','Off', ...
        'OuterPosition',ScreenSize);
    %[]Opens a new window and adjusts its properties.
    
    Axes = axes( ...
        'CameraPosition',Extent*[1,1,1], ...
        'CameraTarget',[0,0,0], ...
        'FontName','Arial', ...
        'FontSize',8, ...
        'FontWeight','Bold', ...
        'Parent',Window, ...
        'PlotBoxAspectRatio',[1,1,1], ...
        'NextPlot','Add', ...
        'XGrid','On', ...
        'YGrid','On', ...
        'ZGrid','On', ...
        'XLim',Extent * [-1,1], ...
        'YLim',Extent * [-1,1], ...
        'ZLim',Extent * [-1,1], ...
        'XTick',Extent * (-1:0.2:1), ...
        'YTick',Extent * (-1:0.2:1), ...
        'ZTick',Extent * (-1:0.2:1),...
        'Color','k');
    %[]Adds an axes to the specified window and adjusts its properties.
    
    surface(xe,ye,-ze, ...
        'CData',Earth, ...
        'EdgeColor','None', ...
        'FaceColor','TextureMap', ...
        'Parent',Axes);
    %[]Adds a plot to the specified axes and adjusts its properties.
    
    plot3(R(1,:),R(2,:),R(3,:), ...
        'Color','w', ...
        'LineStyle','None', ...
        'Marker','.', ...
        'Parent',Axes);
    plot3(R(1,:),R(2,:),-Extent*ones(1,length(R)),'.','color','w');
    plot3(-Extent*ones(1,length(R)),R(2,:),R(3,:),'.','color','w');
    plot3(R(1,:),-Extent*ones(1,length(R)),R(3,:),'.','color','w');
    %[]Adds a plot to the specified axes and adjusts its properties.
    
    plot3([0,Extent],[0,0],[0,0], ...
        'Color','r', ...
        'Linestyle','-', ...
        'LineWidth',3, ...
        'Marker','None', ...
        'Parent',Axes);
    %[]Adds a plot to the specified axes and adjusts its properties.
    
    plot3([0,0],[0,Extent],[0,0], ...
        'Color','r', ...
        'Linestyle','-', ...
        'LineWidth',3, ...
        'Marker','None', ...
        'Parent',Axes);
    %[]Adds a plot to the specified axes and adjusts its properties.
    
    plot3([0,0],[0,0],[0,Extent], ...
        'Color','r', ...
        'Linestyle','-', ...
        'LineWidth',3, ...
        'Marker','None', ...
        'Parent',Axes);
    %[]Adds a plot to the specified axes and adjusts its properties.
    
    xlabel( ...
        'Earth Radii', ...
        'FontSize',16, ...
        'Parent',Axes);
    %[]Adds a label to the specified axis.
    
    ylabel( ...
        'Earth Radii', ...
        'FontSize',16, ...
        'Parent',Axes);
    %[]Adds a label to the specified axis.
    
    zlabel( ...
        'Earth Radii', ...
        'FontSize',16, ...
        'Parent',Axes);
    %[]Adds a label to the specified axis.
    
    text( ...
        'BackGroundColor','w', ...
        'Color','r', ...
        'FontName','Arial', ...
        'FontSize',12, ...
        'FontWeight','Bold', ...
        'HorizontalAlignment','Center', ...
        'LineStyle','None', ...
        'Parent',Axes, ...
        'Position',[Extent,0,0], ...
        'String','X', ...
        'VerticalAlignment','Middle');
    %[]Adds a text box to the specified axes and adjusts its properties.
    
    text( ...
        'BackGroundColor','w', ...
        'Color','r', ...
        'FontName','Arial', ...
        'FontSize',12, ...
        'FontWeight','Bold', ...
        'HorizontalAlignment','Center', ...
        'LineStyle','None', ...
        'Parent',Axes, ...
        'Position',[0,Extent,0], ...
        'String','Y', ...
        'VerticalAlignment','Middle');
    %[]Adds a text box to the specified axes and adjusts its properties.
    
    text( ...
        'BackGroundColor','w', ...
        'Color','r', ...
        'FontName','Arial', ...
        'FontSize',12, ...
        'FontWeight','Bold', ...
        'HorizontalAlignment','Center', ...
        'LineStyle','None', ...
        'Parent',Axes, ...
        'Position',[0,0,Extent], ...
        'String','Z', ...
        'VerticalAlignment','Middle');
    %[]Adds a text box to the specified axes and adjusts its properties.
    
end
%===================================================================================================